package com.always.electrical.energy.web.controller;

import com.always.electrical.energy.web.req.DeviceIdsReq;
import com.always.electrical.energy.web.res.WebBaseResponse;
import com.always.electrical.energy.web.service.MscService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 光、储、充
 */
@RestController
@RequestMapping("/msc")
public class MscApiController {

    @Autowired
    private MscService mscService;

    /**
     * 储能中心（储能）
     */
    @PostMapping("/storage")
    public WebBaseResponse storage(@RequestBody DeviceIdsReq req) {
        return WebBaseResponse.success(mscService.storage(req.getIds()));
    }

    /**
     * 风机
     */
    @PostMapping("/windPower")
    public WebBaseResponse windPower(@RequestBody DeviceIdsReq req) {
        return WebBaseResponse.success(mscService.windPower(req.getIds()));
    }

    /**
     * 充电中心（充电桩）
     */
    @PostMapping("/charge")
    public WebBaseResponse charge(@RequestBody DeviceIdsReq req) {
        return WebBaseResponse.success(mscService.charge(req.getIds()));
    }

    /**
     * 光伏（MPPT)
     */
    @PostMapping("/mppt")
    public WebBaseResponse mppt(@RequestBody DeviceIdsReq req) {
        return WebBaseResponse.success(mscService.mppt(req.getIds()));
    }
}
